import request from '@/axios';

export const getList = (current, size, params) => request({
  url: '/zzy-system/tenant/list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
  },
});

export const getDetail = id => request({
  url: '/zzy-system/tenant/detail',
  method: 'get',
  params: {
    id,
  },
});

export const remove = ids => request({
  url: '/zzy-system/tenant/remove',
  method: 'post',
  params: {
    ids,
  },
});

export const add = row => request({
  url: '/zzy-system/tenant/submit',
  method: 'post',
  data: row,
});

export const update = row => request({
  url: '/zzy-system/tenant/submit',
  method: 'post',
  data: row,
});

export const setting = (ids, form) => request({
  url: '/zzy-system/tenant/setting',
  method: 'post',
  params: {
    ...form,
    ids,
  },
});

export const datasource = (tenantId, datasourceId) => request({
  url: '/zzy-system/tenant/datasource',
  method: 'post',
  params: {
    tenantId,
    datasourceId,
  },
});

export const info = domain => request({
  url: '/zzy-system/tenant/info',
  method: 'get',
  params: {
    domain,
  },
});

export const packageInfo = tenantId => request({
  url: '/zzy-system/tenant/package-detail',
  method: 'get',
  params: {
    tenantId,
  },
});

export const packageSetting = (tenantId, packageId) => request({
  url: '/zzy-system/tenant/package-setting',
  method: 'post',
  params: {
    tenantId,
    packageId,
  },
});
